﻿using DataAccess.Exceptions;
using Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Business.WPF
{
    public class SearchClassroomManager
    {
        public Collection<Classroom> SearchByCode(String code)
        {
            try
            {
                if (String.IsNullOrEmpty(code))
                {
                    return (DataAccess.ClassroomDataAccess.getAll());
                }
                else
                {
                    return (DataAccess.ClassroomDataAccess.getClassroomsByCode(code));
                }
            }
            catch (Exception exception)
            {
                throw new BusinessException("Error: " + exception.Message);
            }
        }
    }
}
